package io;

import java.io.File;
import java.io.IOException;

public class IODemo1 {
    public static void main(String[] args) throws IOException {
//        File file = new File("C:/Users/ljy/Desktop");
        File file = new File("./Desktop");
        System.out.println(file.getParent());//得到上一级目录
        System.out.println(file.getName());//得到本来的名字
        System.out.println(file.getPath());//如果构造对象为绝对路径,下面三个都一样
        System.out.println(file.getAbsoluteFile());
        System.out.println(file.getCanonicalFile());

    }
}
